<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <search ref='search' :config='searchConfig' @getHeight='getHeight' @search='search' />
    <!-- table区域-begin -->
    <div class='page_table'>
      <vxe-grid
        ref='xGrid'
        v-bind='vexConfig'
        :align='left'
        :border='true'
        :checkbox-config="checkboxConfig"
        :columns='columns'
        :data='dataSource'
        :height='pageHeight-seachHeight-90'
        :loading='loading'
        :resizable='true'
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        :showOverflow='true'
        :toolbar-config='tableToolbar'
        size='mini'
        @checkbox-change='selectChangeEvent'
        @checkbox-all='selectChangeEvent'
      >
        <template #toolbar_buttons>
          <div class='table-operator'>
            <a-button type="primary"  @click="downExportXls('sfaVisitKnowledge_service')">导出</a-button>
          </div>
        </template>
        <!--        <template #detail='{ row,rowIndex }'>-->
        <!--          <a @click='handleDetail(row)'>{{ row.createName }}</a>-->
        <!--        </template>-->

        <template #status='{ row }'>
          <a-switch :checked='row.status' size='small' @change='handleStatus(row,$event)' />
        </template>
        <template #imgList='{ row }'>
          <viewer :images='row.imgList' style="height:34px;width: 70px;overflow: hidden">
            <a-avatar v-for="(item,uidx) in row.imgList" :key="uidx" :src="item"
                      shape="square" style="margin-right: 4px"/>
          </viewer>
        </template>
        <template #pager>
          <vxe-pager
            :currentPage.sync='ipagination.current'
            :layouts="['Total', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump','Sizes', 'FullJump']"
            :page-size.sync='ipagination.pageSize'
            :pageSizes='ipagination.pageSizeOptions'
            :total='ipagination.total'
            @page-change='handlePageChange'>
          </vxe-pager>
        </template>
      </vxe-grid>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <inventory-details ref='modalForm'></inventory-details>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import {PageListMixin} from '@/mixins/PageListMixin'
import JDate from '@comp/cn-form/JDate'
import InventoryDetails from './modules/InventoryDetails'

export default {
  name: "SfaVisitTakestockList",
  mixins: [PageListMixin],
  components: {
    JDate,
    InventoryDetails
  },
  data() {
    return {
      description: '拜访知识宣讲报表',
      //查询区域
      searchConfig:[
        // {
        //   type: 'input',
        //   name: 'visitId',
        //   placeholder: '线路编号'
        // },
        {
          type: 'input',
          name: 'visitUserRealName',
          placeholder: '拜访人名'
        },
        {
          type: 'j-select',
          name: 'visitType',
          placeholder: '拜访类型',
          dictCode:'visit_type'
        },
        {
          type: 'date-range', //范围选择
          range: ['searchStartDate', 'searchEndDate'],
          name: 'range',
          format: 'YYYY-MM-DD',
          placeholder: ['开始时间', '结束时间']
        },
      ],
      // 表头
      columns:[
        { type: 'checkbox', width: 50, fixed: 'left' },
        {
          title: '是否存在宣讲内容',
          minWidth:160,
          field: 'isKnowledgeStr',
        },
        {
          title: '拜访人',
          minWidth:80,
          field: 'visitUserName'
        },
        {
          title: '拜访人名',
          minWidth:80,
          field: 'visitUserRealName'
        },
        {
          title: '提交时间',
          minWidth:120,
          field: 'createTime'
        },
        {
          title: '拜访类型',
          minWidth:80,
          field: 'visitTypeStr'
        },
        {
          title: '拜访人职位',
          minWidth:100,
          field: 'visitPosCode'
        },
        {
          title: '拜访人职位名',
          minWidth:100,
          field: 'visitPosName'
        },
        {
          title: '拜访人所属组织编码',
          minWidth:180,
          field: 'orgCode'
        },
        {
          title: '拜访人所属组织名称',
          minWidth:180,
          field: 'orgName'
        },
        {
          title: '备注',
          minWidth:120,
          field: 'remarks'
        },
        {
          title: '图片',
          minWidth:120,
          field: 'imgList',
          slots: { default: 'imgList' },
        },
      ],
      isorter: {
        permflag: 'visit_preach_list'
      },
      url: {
        list: window._CONFIG['domianSfaURL'] + "/visit/sfaVisitKnowledgeController/findPageList",
        exportXlsUrl: window._CONFIG['domianSfaURL'] + "visit/sfaVisitTakestockController/exportXls",
      },
    }
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
  methods: {}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>